package chapter01;

import java.util.Scanner;

public class Test14_While {
    public static void main(String[] args) {
        //判断输入的数字是否为素数
        //只能1和它本身整除
        System.out.println("输入一个整数：");
        Scanner scanner = new Scanner(System.in);
        int number = scanner.nextInt();
        int i = 2;
        boolean flag = false;
        while(i<number){
            if (number % i == 0) {
                flag = true;
                break;
            }
            i++;
        }
        if(!flag){
            System.out.println(number+"是一个素数");
        }else{
            System.out.println(number+"是一个合数");
        }
    }
}
